﻿/************************************************
 * Author       :   XXY
 * Blog         :   https://www.cnblogs.com/jzyl
 * Gitee        :   https://gitee.com/xiaobaichong
 * Email        :   1047185209@QQ.com
 * FileName     :   Hotfix.cs
 * CreateData   :   2023/4/28 14:49:30
 * UnityVersion :   2020.3.33f1c2
 * Description  :   游戏逻辑驱动
************************************************/

using Main;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
namespace Hotfix
{
    internal class Hotfix
    {
        private Hotfix(GameObject master)
        {
            // 属性赋值
            Utility.SetPropertyValue(Game.Instance, "director", master);
            Utility.SetPropertyValue(Game.Instance, "componentIDE", master.GetComponent<ComponentIDE>());
        }
        private void Awake()
        {
            //LogUtillity.Log("Hotfix Awake");
            Game.Instance.GetActiveScene?.Awake();
        }
        private void OnEnable()
        {
            //LogUtillity.Log("Hotfix OnEnable");
            Game.Instance.GetActiveScene?.OnEnable();
        }
        private void Start()
        {
            //LogUtillity.Log("Hotfix Start");
            Game.Instance.GetActiveScene?.Start();
            Init.Start();
        }
        private void OnDisable()
        {
            //LogUtillity.Log("Hotfix OnDisable");
            Game.Instance.GetActiveScene?.OnDisable();
        }
        private void Update()
        {
            //LogUtillity.Log("Hotfix Update");
            Game.Instance.GetActiveScene?.Update();
        }
        private void LateUpdate()
        {
            //LogUtillity.Log("Hotfix LateUpdate");
            Game.Instance.GetActiveScene?.LateUpdate();
        }
        private void FixedUpdate()
        {
            //LogUtillity.Log("Hotfix FixedUpdate");
            Game.Instance.GetActiveScene?.FixedUpdate();
        }
        private void OnDestroy()
        {
            //LogUtillity.Log("Hotfix OnDestroy");
            Game.Instance.GetActiveScene?.OnDestroy();
        }
    }
}